
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The asciimath2jax Preprocessor &mdash; MathJax v2.0 documentation</title>
    <link rel="stylesheet" href="../_static/mj.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <!--<script type="text/javascript" src="../../../MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>-->
    <link rel="top" title="MathJax v2.0 documentation" href="../index.html" />
    <link rel="up" title="Configuration Objects" href="index.html" />
    <link rel="next" title="The jsMath2jax Preprocessor" href="jsMath2jax.html" />
    <link rel="prev" title="The mml2jax Preprocessor" href="mml2jax.html" /> 
  </head>
  <body>
    
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="jsMath2jax.html" title="The jsMath2jax Preprocessor"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mml2jax.html" title="The mml2jax Preprocessor"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">MathJax v2.0 documentation</a> &raquo;</li>
          <li><a href="index.html" accesskey="U">Configuration Objects</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="the-asciimath2jax-preprocessor">
<span id="configure-asciimath2jax"></span><h1>The asciimath2jax Preprocessor<a class="headerlink" href="#the-asciimath2jax-preprocessor" title="Permalink to this headline">¶</a></h1>
<p>The options below control the operation of the <cite>asciimath2jax</cite> preprocessor
that is run when you include <tt class="docutils literal"><span class="pre">&quot;asciimath2jax.js&quot;</span></tt> in the <cite>extensions</cite> array
of your configuration.  They are listed with their default values.  To
set any of these options, include a <tt class="docutils literal"><span class="pre">asciimath2jax</span></tt> section in your
<tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Hub.Config()</span></tt> call.  For example</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
  <span class="nx">asciimath2jax</span><span class="o">:</span> <span class="p">{</span>
    <span class="nx">delimiters</span><span class="o">:</span> <span class="p">[[</span><span class="s1">&#39;`&#39;</span><span class="p">,</span><span class="s1">&#39;`&#39;</span><span class="p">],</span> <span class="p">[</span><span class="s1">&#39;$&#39;</span><span class="p">,</span><span class="s1">&#39;$&#39;</span><span class="p">]]</span>
  <span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
<p>would set the ASCIIMath delimiters for the <cite>asciimath2jax</cite>
preprocessor to include dollar signs as well as back-ticks.</p>
<dl class="describe">
<dt>
<tt class="descname">delimiters: [['`','`']]</tt></dt>
<dd><p>Array of pairs of strings that are to be used as math
delimiters.  The first in each pair is the initial delimiter and
the second is the terminal delimiter.  You can have as many pairs
as you want.  For example,</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[</span> <span class="p">[</span><span class="s1">&#39;$&#39;</span><span class="p">,</span><span class="s1">&#39;$&#39;</span><span class="p">],</span> <span class="p">[</span><span class="s1">&#39;`&#39;</span><span class="p">,</span><span class="s1">&#39;`&#39;</span><span class="p">]</span> <span class="p">]</span>
</pre></div>
</div>
<p>would cause <cite>asciimath2jax</cite> to look for <tt class="docutils literal"><span class="pre">$...$</span></tt> and <tt class="docutils literal"><span class="pre">`...`</span></tt> as
delimiters for inline mathematics.  (Note that the single dollar
signs are not enabled by default because they are used too
frequently in normal text, so if you want to use them for math
delimiters, you must specify them explicitly.)</p>
<p>Note that the delimiters can&#8217;t look like HTML tags (i.e., can&#8217;t
include the less-than sign), as these would be turned into tags by
the browser before MathJax has the chance to run.  You can only
include text, not tags, as your math delimiters.</p>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">preview: &quot;AsciiMath&quot;</tt></dt>
<dd><p>This controls whether <cite>asciimath2jax</cite> inserts <tt class="docutils literal"><span class="pre">MathJax_Preview</span></tt>
spans to make a preview available, and what preview to use, when
it locates in-line or display mathematics in the page.  The
default is <tt class="docutils literal"><span class="pre">&quot;AsciiMath&quot;</span></tt>, which means use the ASCIIMath code as
the preview (which will be visible until it is processed by
MathJax).  Set to <tt class="docutils literal"><span class="pre">&quot;none&quot;</span></tt> to prevent previews from being
inserted (the math will simply disappear until it is typeset).
Set to an array containing the description of an HTML snippet in
order to use the same preview for all equations on the page.</p>
<p>Examples:</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">preview</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;[math]&quot;</span><span class="p">],</span>     <span class="c1">//  insert the text &quot;[math]&quot; as the preview</span>
</pre></div>
</div>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">preview</span><span class="o">:</span> <span class="p">[[</span><span class="s2">&quot;img&quot;</span><span class="p">,{</span><span class="nx">src</span><span class="o">:</span> <span class="s2">&quot;/images/mypic.jpg&quot;</span><span class="p">}]],</span>  <span class="c1">// insert an image as the preview</span>
</pre></div>
</div>
<p>See the <a class="reference internal" href="../HTML-snippets.html#html-snippets"><em>description of HTML snippets</em></a> for
details on how to represent HTML code in this way.</p>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">skipTags: [&quot;script&quot;,&quot;noscript&quot;,&quot;style&quot;,&quot;textarea&quot;,&quot;pre&quot;,&quot;code&quot;]</tt></dt>
<dd><p>This array lists the names of the tags whose contents should not
be processed by <cite>asciimath2jax</cite> (other than to look for
ignore/process classes as listed below).  You can add to (or
remove from) this list to prevent MathJax from processing
mathematics in specific contexts.</p>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">ignoreClass: &quot;asciimath2jax_ignore&quot;</tt></dt>
<dd><p>This is the class name used to mark elements whose contents should
not be processed by asciimath2jax (other than to look for the
<tt class="docutils literal"><span class="pre">processClass</span></tt> pattern below).  Note that this is a regular
expression, and so you need to be sure to quote any <cite>regexp</cite>
special characters.  The pattern is inserted into one that
requires your pattern to match a complete word, so setting
<tt class="docutils literal"><span class="pre">ignoreClass:</span> <span class="pre">&quot;class2&quot;</span></tt> would cause it to match an element with
<tt class="docutils literal"><span class="pre">class=&quot;class1</span> <span class="pre">class2</span> <span class="pre">class3&quot;</span></tt> but not <tt class="docutils literal"><span class="pre">class=&quot;myclass2&quot;</span></tt>.
Note that you can assign several classes by separating them by the
vertical line character (<tt class="docutils literal"><span class="pre">|</span></tt>).  For instance, with
<tt class="docutils literal"><span class="pre">ignoreClass:</span> <span class="pre">&quot;class1|class2&quot;</span></tt> any element assigned a class of
either <tt class="docutils literal"><span class="pre">class1</span></tt> or <tt class="docutils literal"><span class="pre">class2</span></tt> will be skipped.</p>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">processClass: &quot;asciimath2jax_process&quot;</tt></dt>
<dd><p>This is the class name used to mark elements whose contents
<em>should</em> be processed by <cite>asciimath2jax</cite>.  This is used to restart
processing within tags that have been marked as ignored via the
<tt class="docutils literal"><span class="pre">ignoreClass</span></tt> or to cause a tag that appears in the <tt class="docutils literal"><span class="pre">skipTags</span></tt>
list to be processed rather than skipped.  Note that this is a
regular expression, and so you need to be sure to quote any
<cite>regexp</cite> special characters.  The pattern is inserted into one
that requires your pattern to match a complete word, so setting
<tt class="docutils literal"><span class="pre">processClass:</span> <span class="pre">&quot;class2&quot;</span></tt> would cause it to match an element with
<tt class="docutils literal"><span class="pre">class=&quot;class1</span> <span class="pre">class2</span> <span class="pre">class3&quot;</span></tt> but not <tt class="docutils literal"><span class="pre">class=&quot;myclass2&quot;</span></tt>.
Note that you can assign several classes by separating them by the
vertical line character (<tt class="docutils literal"><span class="pre">|</span></tt>).  For instance, with
<tt class="docutils literal"><span class="pre">processClass:</span> <span class="pre">&quot;class1|class2&quot;</span></tt> any element assigned a class of
either <tt class="docutils literal"><span class="pre">class1</span></tt> or <tt class="docutils literal"><span class="pre">class2</span></tt> will have its contents processed.</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="mml2jax.html"
                        title="previous chapter">The mml2jax Preprocessor</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="jsMath2jax.html"
                        title="next chapter">The jsMath2jax Preprocessor</a></p>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="jsMath2jax.html" title="The jsMath2jax Preprocessor"
             >next</a> |</li>
        <li class="right" >
          <a href="mml2jax.html" title="The mml2jax Preprocessor"
             >previous</a> |</li>
        <li><a href="../index.html">MathJax v2.0 documentation</a> &raquo;</li>
          <li><a href="index.html" >Configuration Objects</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012 Design Science.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
    
  </body>
</html>